<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>14-v-model在select中的使用</title>
</head>
<body>
    <div id="app">
        <div>
            <select name="fruit" id="fruit" v-model="fruit">
                <option value="banana">香蕉</option>
                <option value="apple">苹果</option>
                <option value="orange">橘子</option>
            </select>
            当前选择的水果是: {{fruit}}
        </div>
        <div>
            <select name="fruits" id="fruits" v-model="fruits" multiple>
                <option v-for="item in fruitOptions" :value="item.value">{{item.name}}</option>
            </select>
            当前选择的水果是: {{fruits}}
        </div>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                fruit: "apple",
                fruits: [],
                fruitOptions: [
                    { name: "香蕉", value: "banana" },
                    { name: "苹果", value: "apple" },
                    { name: "橘子", value: "orange" },
                ]
            }
        })
    </script>
</body>
</html>